Add validation for group customization: Check for duplicate names and GIDs#43
Merged
supakeen merged 4 commits intoosbuild:mainfrom Jan 21, 2026
Merged
Conversation
We're going to make some changes to the group customization handling, so let's first move the two (related) customizations to their own file to keep things tidy. Move the related tests as well for the same reason.
Add some extra test cases for the simple test before we add validation.
Add a validator for the group customizations. Create a type for []GroupCustomization so we can add the Validate() method. Run the validator when GetGroups() is called. This changes the signature of the method, which is a breaking API change and will need adjustments when the library is updated in images.
Add validation error test cases to TestGetGroups().
Member
Author
|
This is a follow up from osbuild/images#2146 (comment) |
lzap
reviewed
Jan 21, 2026
| SSHKey []SSHKeyCustomization `json:"sshkey,omitempty" toml:"sshkey,omitempty"` | ||
| User []UserCustomization `json:"user,omitempty" toml:"user,omitempty"` | ||
| Group []GroupCustomization `json:"group,omitempty" toml:"group,omitempty"` | ||
| Group GroupsCustomization `json:"group,omitempty" toml:"group,omitempty"` |
Contributor
There was a problem hiding this comment.
Wait what, are you breaking the user-space here?
lzap
reviewed
Jan 21, 2026
| return users | ||
| } | ||
|
|
||
| type GroupsCustomization []GroupCustomization |
lzap
approved these changes
Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a
Validate()method for group customizations and call the validator whenGetGroups()is called. The validator checks for duplicate names and/or GIDs and returns an error for each duplicate value.This changes the signature of the method, which is a breaking API change and will need adjustments when the library is updated in images.